#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <vector>
#include <stack>
#include <queue>
#include <set>
using namespace std;
class Solution
{
public:
    int lengthOfLIS(vector<int> &nums)
    {
        int ans = -1;
        vector<int> dp(nums.size(), 1);
        /**
         *      dp[i] 表示从第0到第i个数组中以第i个元素结尾的最长严格递增子序列的长度
         *      dp[i] = max(dp[j] + 1)
         */
        for (int i = 1; i < nums.size(); ++i)
        {
            for (int j = 0; j < i; ++j)
            {
                if (nums[j] < nums[i])
                    dp[i] = max(dp[j] + 1, dp[i]);
            }
            ans = max(ans, dp[i]);
        }
        return ans;
    }
};